php listen to select event

114

<html>
<head>
</head>
<body>
    <?php
        function OnSelectionChange() {
            echo("OK IT WORKS");
        }    
    ?>
<section>
    <select onchange="OnSelectionChange()">
        <option value='' disabled selected>Assign Driver</option>
        <option value='4353'>Steve Jobs</option>
        <option value='3333'>Ian Wright</option>
        <option value='66666'>Mark James</option>
    </select>
</section>    
      
 // NEW LINE     
  <form method="POST" action="">
      Select Your Country 
      <select name="country" onchange="this.form.submit()">
          <option value="" disabled selected>--select--</option>
          <option value="india">India</option>
          <option value="us">Us</option>
          <option value="europe">Europe</option>
      </select>
  </form>
<?php
   if(isset($_POST["country"])){
       $country=$_POST["country"];
       echo "select country is => ".$country;
   }
?>
</body>
</html>

Comments

Submit
0 Comments